﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Primitives;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition.Hosting;
using Microsoft.ComponentModel.Composition.Diagnostics;
using MouseExtender.Interfaces;
using MouseExtender.Plugins.Item;
using MouseExtender.Model;
using System.ComponentModel.Composition.Diagnostics;


namespace MouseExtender.Logic
{
    public class Bootstrapper
    {
        [STAThread]
        public static void Main(string[] args)
        {
            Initialize();
            App mouseExtender = new App();
            mouseExtender.InitializeComponent();
            mouseExtender.Run();
        }
        private static StringWriter _wr = new StringWriter();
        private static void Initialize()
        {

            var catalog = new AssemblyCatalog(System.Reflection.Assembly.GetExecutingAssembly());
            AppContext.Container = new CompositionContainer(catalog);
            var ci = new CompositionInfo(catalog, AppContext.Container);
            CompositionInfoTextFormatter.Write(ci, _wr);
            AppContext.PluginManager = new PluginManager();
            AppContext.Container.ComposeParts(AppContext.PluginManager);
            AppContext.PluginManager.InitializePlugins();
            AppContext.LauncherItems = new List<IItem>() { new LauncherItem()
                                                               {
                                                                   ToolTip = "lassada",
                                                                   ContentType = "Program"
                                                               },
                                                               new LauncherItem()
                                                                {
                                                                    ToolTip = "1231",
                                                                    ContentType = "Link"
                                                                }
            };
        }

        public static void DumpDebug()
        {
            Debug.Write(_wr.ToString());
        }
    }


}
